#include <iostream>

using namespace std;
typedef unsigned long long BIG;

int main()
{
	BIG result = 0, max = 0;

	for(BIG i = 999999; i>2; i--)
	{
		BIG n = i, c = 1;
		while(n>1)
		{
			c++;
			n = (n%2 ? 3*n+1 : n/2);
		}
		if(c > max)
		{
			max = c;
			result = i;
		}
	}
	cout << result << endl;
	return 0;
}
